package edu.zut.cs.network;

import java.util.Scanner;

public class SwitchDemo {
    /*
     * @param args
     * 功能：成绩在90-100为优秀，60-89为合格，0-59为不合格。
     */
    public static void main(String[] args) {
//    从键盘输入课程成绩
        int score;
        System.out.println("请输入课程成绩：");
        Scanner input = new Scanner(System.in);
        score = input.nextInt();

//    switch进行成绩的评定
        if(score >= 0 && score <= 100) {
            switch (score / 10) {
                case 10:
                case 9:
                    System.out.println("优秀");
                    break;
                case 8:
                    System.out.println("良好");
                    break;
                case 7:
                    System.out.println("中等");
                    break;
                case 6:
                    System.out.println("合格");
                    break;
                default :
                    System.out.println("不合格");
                    break;
             /*
             case 5:
             case 4:
             case 3:
             case 2:
             case 1:
             case 0:
                 System.out.println("不合格");
                 break;
             */
            }
        }
        else
            System.out.println("输入的成绩不合法");
    }
}

